<ol class="breadcrumb">
    <li> <i class="fa fa-anchor"></i>
        &nbsp;厂商运营商
    </li>
    <li>修改信息</li>
</ol>
<div class="col-xs-12 info-center" >
    <div class="bs-callout bs-callout-warning">
        <h4>
            系统使用单位: <strong>{:C('COLLEGE_NAME')}</strong>
        </h4>
    </div>
</div>
<div class="col-xs-12 info-center">
   <if condition="$_GET['tab'] eq 1">
       <!-- 运营商区域 -->
       <div class="panel panel-mcit">
           <div class="panel-heading">
               <i class="fa fa-list"></i>
               &nbsp;&nbsp;运营商信息修改
           </div>
           <div class="panel-body">
               <div class="alert alert-warning">
                   <p><i class="fa fa-paperclip"></i>&nbsp;修改运营商信息</p>
               </div>
               <form class="mcit-dataform" id="data_form" method="post" action={:U("Fac/editFac")}>
                   <div class="panel-footer">
                       <div class="panel-mcit">

                           <div class="col-xs-6">
                               <div class="input-group">
                                   <span class="input-group-addon">账号</span>
                                   <input type="hidden" name="id" value="{$fac.id}"/>
                                   <input type="text" id="login_time"  class="form-control" name="fac_login_name" value="{$fac.fac_login_name}" readonly>
                               </div>
                           </div><div class="clearfix" ></div>

                           <div class="col-xs-6">
                               <div class="input-group">
                                   <span class="input-group-addon">运营商名称</span>
                                   <input type="text" id="pinpai"   name="fac_name" class="form-control" value="{$fac.fac_name}">
                               </div>
                           </div>
                           <div class="col-xs-5">
                               <div class="input-group">
                                   <span class="input-group-addon">厂商地址</span>
                                   <input type="text" id="address"  name="address" class="form-control" value="{$fac.address}">
                               </div>
                           </div><div class="clearfix" ></div>

                           <div class="col-xs-6">
                               <button type="submit" class="btn btn-warning"><i class="fa fa-upload"></i>&nbsp;保存</button>
                               <a href="javascript:history.go(-1);" class="btn btn-warning"><i class="fa fa-mail-reply"></i>&nbsp;返回</a>
                           </div>
                           <div class="clearfix"></div>

                       </div>
                   </div>
               </form>
           </div>
       </div>
   <else />
       <!-- 厂商区域 -->
       <div class="panel panel-mcit">
           <div class="panel-heading">
               <i class="fa fa-list"></i>
               &nbsp;&nbsp;生产厂商信息修改
           </div>
           <div class="panel-body">
               <div class="alert alert-warning">
                   <p><i class="fa fa-paperclip"></i>&nbsp;修改厂家信息</p>
               </div>
               <form class="mcit-dataform" id="data_form" method="post" action={:U("Fac/editFac")}>
                   <div class="panel-footer">
                       <div class="panel-mcit">

                           <div class="col-xs-6">
                               <div class="input-group">
                                   <span class="input-group-addon">账号</span>
                                   <input type="hidden" name="id" value="{$fac.id}"/>
                                   <input type="text" id="login_time"  class="form-control" name="fac_login_name" value="{$fac.fac_login_name}" readonly>
                               </div>
                           </div>

                           <div class="col-xs-6">
                               <div class="input-group">
                                   <span class="input-group-addon">厂商名称</span>
                                   <input type="text" id="phone"   name="name" class="form-control" value="{$fac.name}">
                               </div>
                           </div>

                           <div class="col-xs-5">
                               <div class="input-group">
                                   <span class="input-group-addon">品牌名称</span>
                                   <input type="text" id="pinpai"   name="fac_name" class="form-control" value="{$fac.fac_name}">
                               </div>
                           </div><div class="clearfix" ></div>

                           <div class="col-xs-6">
                               <div class="input-group">
                                   <span class="input-group-addon">硬件密码</span>
                                   <input type="text" id="key"  name="key" class="form-control" value="{$fac.key}">
                               </div>
                           </div>

                           <div class="col-xs-5">
                               <div class="input-group">
                                   <span class="input-group-addon">IP+端口</span>
                                   <input type="text" id="ip_port"   name="ip_port" class="form-control" value="{$fac.ip_port}">
                               </div>
                           </div><div class="clearfix" ></div>

                           <div class="col-xs-6">
                               <div class="input-group">
                                   <span class="input-group-addon">厂商地址</span>
                                   <input type="text" id="address"  name="address" class="form-control" value="{$fac.address}">
                               </div>
                           </div>

                           <div class="col-xs-5">
                               <div class="input-group">
                                   <span class="input-group-addon">软件版本</span>
                                   <input type="text" id="soft_version"  name="soft_version" class="form-control" value="{$fac.soft_version}">
                               </div>
                           </div>
                           <div class="clearfix" ></div>

                           <div class="col-xs-6">
                               <button type="submit" class="btn btn-warning"><i class="fa fa-upload"></i>&nbsp;保存</button>
                               <a href="javascript:history.go(-1);" class="btn btn-warning"><i class="fa fa-mail-reply"></i>&nbsp;返回</a>
                           </div>
                           <div class="clearfix"></div>

                       </div>
                   </div>
               </form>
           </div>
       </div>
   </if>
</div>

    <!--修改密码-->
<div class="col-xs-12 info-center">
    <if condition="$_GET['tab'] eq 1">
        <!-- 运营商区域 -->
        <div class="panel panel-mcit">
            <div class="panel-heading">
                <i class="fa fa-list"></i>
                &nbsp;&nbsp;密码设置
            </div>
            <div class="panel-body">
                <div class="alert alert-warning">
                    <p><i class="fa fa-paperclip"></i>&nbsp;重设密码</p>
                </div>
                <form class="mcit-dataform" id="data_form1" method="post" action={:U("Fac/editFacPwd")}>
                    <div class="panel-footer">
                        <div class="panel-mcit">

                            <div class="col-xs-6">
                                <div class="input-group">
                                    <span class="input-group-addon">账号</span>
                                    <input type="hidden" name="id" value="{$fac.id}"/>
                                    <input type="text"   class="form-control" name="fac_login_name" value="{$fac.fac_login_name}" readonly>
                                    <input type="hidden" name="type" value="3"/>
                                </div>
                            </div>
                            <div class="clearfix" ></div>

                            <div class="col-xs-6">
                                <div class="input-group">
                                    <span class="input-group-addon">新密码</span>
                                    <input type="text" id="pwd1"   name="pwd1" class="form-control" placeholder="密码不能少于8位">
                                </div>
                            </div>
                            <div class="clearfix" ></div>

                            <div class="col-xs-6">
                                <div class="input-group">
                                    <span class="input-group-addon">重复密码</span>
                                    <input type="text" id="pwd2"  name="pwd2" class="form-control" placeholder="密码不能少于8位">
                                </div>
                            </div>
                            <div class="clearfix" ></div>

                            <div class="col-xs-6">
                                <button type="submit" class="btn btn-warning"><i class="fa fa-upload"></i>&nbsp;保存</button>
                                <a href="javascript:history.go(-1);" class="btn btn-warning"><i class="fa fa-mail-reply"></i>&nbsp;返回</a>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    <else />
        <!-- 厂商区域 -->
        <div class="panel panel-mcit">
            <div class="panel-heading">
                <i class="fa fa-list"></i>
                &nbsp;&nbsp;密码设置
            </div>
            <div class="panel-body">
                <div class="alert alert-warning">
                    <p><i class="fa fa-paperclip"></i>&nbsp;重设密码</p>
                </div>
                <form class="mcit-dataform" id="data_form1" method="post" action={:U("Fac/editFacPwd")}>
                    <div class="panel-footer">
                        <div class="panel-mcit">

                            <div class="col-xs-6">
                                <div class="input-group">
                                    <span class="input-group-addon">账号</span>
                                    <input type="hidden" name="id" value="{$fac.id}"/>
                                    <input type="text"   class="form-control" name="fac_login_name" value="{$fac.fac_login_name}" readonly>
                                    <input type="hidden" name="type" value="2"/>
                                </div>
                            </div>
                            <div class="clearfix" ></div>

                            <div class="col-xs-6">
                                <div class="input-group">
                                    <span class="input-group-addon">新密码</span>
                                    <input type="text" id="pwd1"   name="pwd1" class="form-control" placeholder="密码不能少于8位">
                                </div>
                            </div>
                            <div class="clearfix" ></div>

                            <div class="col-xs-6">
                                <div class="input-group">
                                    <span class="input-group-addon">重复密码</span>
                                    <input type="text" id="pwd2"  name="pwd2" class="form-control" placeholder="密码不能少于8位">
                                </div>
                            </div>
                            <div class="clearfix" ></div>

                            <div class="col-xs-6">
                                <button type="submit" class="btn btn-warning"><i class="fa fa-upload"></i>&nbsp;保存</button>
                                <a href="javascript:history.go(-1);" class="btn btn-warning"><i class="fa fa-mail-reply"></i>&nbsp;返回</a>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </if>
</div>

<script>
    $("#data_form").ajaxForm({
        dataType:'json',
        clearForm:true,
        beforeSubmit:function(){
            if($("#phone").val()==''){
                alertify.error("请填写厂商名称");
                return false;
            }
            if($("#pinpai").val()==''){
                alertify.error("请填写品牌名称");
                return false;
            }
            if($("#key").val()==''){
                alertify.error("请填写硬件密码");
                return false;
            }
            if($("#ip_port").val()==''){
                alertify.error("请填写ip:端口");
                return false;
            }
            if($("#address").val()==''){
                alertify.error("请填写厂商地址");
                return false;
            }
            return true
        },
        success:function(data){
            if(data.state==100){
                alertify.success(data.msg);
                location.href = data.url;
            }else{
                alertify.error(data.msg);
                //alert(data.msg);
            }
        }
    });
    $("#data_form1").ajaxForm({
        dataType:'json',
        clearForm:true,
        beforeSubmit:function(){
            var pwd1 = $("#pwd1").val();
            var pwd2 = $("#pwd2").val();
            if(pwd1 == '' || pwd1.length < 8){
                alertify.error("密码不能为空或小于8位！");
                return false;
            }
            if(pwd2 == '' || pwd2.length < 8){
                alertify.error("密码不能为空或小于8位！");
                return false;
            }else if(pwd1 != pwd2){
                alertify.error("两次密码输入不一致，请重新输入！");
                return false;
            }
            return true
        },
        success:function(data){
            if(data.state==100){
                alertify.success(data.msg);
                location.href = data.url;
            }else{
                alertify.error(data.msg);
                //alert(data.msg);
            }
        }
    });
</script>